<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class template uniform_real_distribution</title>
<link rel="stylesheet" href="../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="Chapter 1. Boost.Compute">
<link rel="up" href="../../boost_compute/reference.html#header.boost.compute.random.uniform_real_distribution_hpp" title="Header &lt;boost/compute/random/uniform_real_distribution.hpp&gt;">
<link rel="prev" href="uniform_int_distribution.html" title="Class template uniform_int_distribution">
<link rel="next" href="is_device_iterator.html" title="Struct template is_device_iterator">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="uniform_int_distribution.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_compute/reference.html#header.boost.compute.random.uniform_real_distribution_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="is_device_iterator.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.compute.uniform_real_distribution"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template uniform_real_distribution</span></h2>
<p>boost::compute::uniform_real_distribution — Produces uniformly distributed random floating-point numbers. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../boost_compute/reference.html#header.boost.compute.random.uniform_real_distribution_hpp" title="Header &lt;boost/compute/random/uniform_real_distribution.hpp&gt;">boost/compute/random/uniform_real_distribution.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> RealType <span class="special">=</span> <span class="keyword">float</span><span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="uniform_real_distribution.html" title="Class template uniform_real_distribution">uniform_real_distribution</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// types</span>
  <span class="keyword">typedef</span> <span class="identifier">RealType</span> <a name="boost.compute.uniform_real_distribution.result_type"></a><span class="identifier">result_type</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="uniform_real_distribution.html#boost.compute.uniform_real_distributionconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="uniform_real_distribution.html#idm45822164890384-bb"><span class="identifier">uniform_real_distribution</span></a><span class="special">(</span><span class="identifier">RealType</span> <span class="special">=</span> <span class="number">0</span><span class="special">.</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">RealType</span> <span class="special">=</span> <span class="number">1</span><span class="special">.</span><span class="identifier">f</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="uniform_real_distribution.html#idm45822164886784-bb"><span class="special">~</span><span class="identifier">uniform_real_distribution</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="uniform_real_distribution.html#idm45822164900368-bb">public member functions</a></span>
  <span class="identifier">result_type</span> <a class="link" href="uniform_real_distribution.html#idm45822164899808-bb"><span class="identifier">a</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="identifier">result_type</span> <a class="link" href="uniform_real_distribution.html#idm45822164898368-bb"><span class="identifier">b</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> OutputIterator<span class="special">,</span> <span class="keyword">typename</span> Generator<span class="special">&gt;</span> 
    <span class="keyword">void</span> <a class="link" href="uniform_real_distribution.html#idm45822164896928-bb"><span class="identifier">generate</span></a><span class="special">(</span><span class="identifier">OutputIterator</span><span class="special">,</span> <span class="identifier">OutputIterator</span><span class="special">,</span> <span class="identifier">Generator</span> <span class="special">&amp;</span><span class="special">,</span> 
                  <span class="identifier">command_queue</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="uniform_real_distribution.html#idm45822164885440-bb">private member functions</a></span>
   <a class="link" href="uniform_real_distribution.html#idm45822164884864-bb"><span class="identifier">BOOST_STATIC_ASSERT_MSG</span></a><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_floating_point</span><span class="special">&lt;</span> <span class="identifier">RealType</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span> 
                           <span class="string">"Template argument must be a floating point type"</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idm46604969882560"></a><h2>Description</h2>
<p>The following example shows how to setup a uniform real distribution to produce random <code class="computeroutput">float</code> values between <code class="computeroutput">1</code> and <code class="computeroutput">100</code>.</p>
<pre class="programlisting"></pre>
<p> </p>
<p><span class="bold"><strong>See Also:</strong></span></p>
<p>default_random_engine, <a class="link" href="normal_distribution.html" title="Class template normal_distribution">normal_distribution</a> </p>
<p>
</p>
<p>
</p>
<div class="refsect2">
<a name="idm46604969876912"></a><h3>
<a name="boost.compute.uniform_real_distributionconstruct-copy-destruct"></a><code class="computeroutput">uniform_real_distribution</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="idm45822164890384-bb"></a><span class="identifier">uniform_real_distribution</span><span class="special">(</span><span class="identifier">RealType</span> a <span class="special">=</span> <span class="number">0</span><span class="special">.</span><span class="identifier">f</span><span class="special">,</span> <span class="identifier">RealType</span> b <span class="special">=</span> <span class="number">1</span><span class="special">.</span><span class="identifier">f</span><span class="special">)</span><span class="special">;</span></pre>
<p>Creates a new uniform distribution producing numbers in the range [<code class="computeroutput">a</code>, <code class="computeroutput">b</code>). Requires a &lt; b </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idm45822164886784-bb"></a><span class="special">~</span><span class="identifier">uniform_real_distribution</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Destroys the <code class="computeroutput"><a class="link" href="uniform_real_distribution.html" title="Class template uniform_real_distribution">uniform_real_distribution</a></code> object. </li>
</ol></div>
</div>
<div class="refsect2">
<a name="idm46604969857344"></a><h3>
<a name="idm45822164900368-bb"></a><code class="computeroutput">uniform_real_distribution</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="identifier">result_type</span> <a name="idm45822164899808-bb"></a><span class="identifier">a</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns the minimum value of the distribution. </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">result_type</span> <a name="idm45822164898368-bb"></a><span class="identifier">b</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Returns the maximum value of the distribution. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> OutputIterator<span class="special">,</span> <span class="keyword">typename</span> Generator<span class="special">&gt;</span> 
  <span class="keyword">void</span> <a name="idm45822164896928-bb"></a><span class="identifier">generate</span><span class="special">(</span><span class="identifier">OutputIterator</span> first<span class="special">,</span> <span class="identifier">OutputIterator</span> last<span class="special">,</span> 
                <span class="identifier">Generator</span> <span class="special">&amp;</span> generator<span class="special">,</span> <span class="identifier">command_queue</span> <span class="special">&amp;</span> queue<span class="special">)</span><span class="special">;</span></pre>
<p>Generates uniformly distributed floating-point numbers and stores them to the range [<code class="computeroutput">first</code>, <code class="computeroutput">last</code>). </p>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idm46604969828784"></a><h3>
<a name="idm45822164885440-bb"></a><code class="computeroutput">uniform_real_distribution</code> private member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><pre class="literallayout"> <a name="idm45822164884864-bb"></a><span class="identifier">BOOST_STATIC_ASSERT_MSG</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">is_floating_point</span><span class="special">&lt;</span> <span class="identifier">RealType</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">value</span><span class="special">,</span> 
                         <span class="string">"Template argument must be a floating point type"</span><span class="special">)</span><span class="special">;</span></pre></li></ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2013, 2014 Kyle Lutz<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="uniform_int_distribution.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_compute/reference.html#header.boost.compute.random.uniform_real_distribution_hpp"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="is_device_iterator.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
